/*
 *  jOTR - Java Off-The-Record Messaging Library
 *  Copyright (C) 2007 Markus Karnik
 *
 *  This program is free software; you can redistribute it and/or modify it 
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; either version 3 of the License, 
 *  or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 *  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 *  for more details.
 *
 *  You should have received a copy of the GNU General Public License along 
 *  with this program; if not, see <http://www.gnu.org/licenses/>.
 *  
 */

package de.karnik.libjotr;

/**
 * Constant values of the jOTR library.
 * 
 * @author Markus Karnik - markus.karnik@my-design.org
 * @version 1.0
 * @since 1.0
 */
public interface JotrConstants {
	
	/**
	 * The D-H Commit Message type (0x02).
	 */
	public static final int MESSAGE_TYPE_DH_COMMIT_MSG = 0x02;
	/**
	 * The Data Message type (0x03).
	 */
	public static final int MESSAGE_TYPE_DATA_MSG = 0x03;
	/**
	 * The Reveal Signature Message type (0x11).
	 */
	public static final int MESSAGE_TYPE_REVEAL_SIG_MSG = 0x11;
	/**
	 * The Signature Message type (0x12).
	 */
	public static final int  MESSAGE_TYPE_SIG_MSG = 0x12;
	/**
	 * The D-H Key Message type (0x0a).
	 */
	public static final int MESSAGE_TYPE_DH_KEY_MSG = 0x0a;
	/**
	 * The Query Message type (0x00).
	 */
	public static final int MESSAGE_TYPE_QUERY_MSG = 0x00;
	/**
	 * The Error Message type (0xff).
	 */
	public static final int MESSAGE_TYPE_ERROR_MSG = 0xff;
	
	/**
	 * The DH1536 group modulus value in hex-string notation.
	 */
	public static final String DH1536_MODULUS_S = "00" 
		+ "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
	    + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD"
	    + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
	    + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"
	    + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"
	    + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F"
	    + "83655D23DCA3AD961C62F356208552BB9ED529077096966D"
	    + "670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF";
	/**
	 * The DH1536 group generator value in hex-string notation.
	 */
	public static final String DH1536_GENERATOR_S = "2";
	/**
	 * The DH1536 group bit count value (1536).
	 */
	public static final int BIT_COUNT_DH1536 = 1536;
	/**
	 * The DH1536 group byte count value (1536/8).
	 */
	public static final int BYTE_COUNT_DH1536 = BIT_COUNT_DH1536 / 8;

	/**
	 * The otr basic whitespace-tag.
	 */
	public static final char[] WHITESPACE_TAG_BASIC = { (char)0x20, (char)0x09,(char)0x20,(char)0x20,(char)0x09,(char)0x09,(char)0x09,(char)0x09,
		(char)0x20, (char)0x09,(char)0x20,(char)0x09,(char)0x20,(char)0x09,(char)0x20,(char)0x20 };
	/**
	 * The otr version 1 whitespace-tag.
	 */
	public static final char[] WHITESPACE_TAG_V1 = { (char)0x20, (char)0x09,(char)0x20,(char)0x09,(char)0x20,(char)0x20,(char)0x09,(char)0x20 };
	/**
	 * The otr version 2 whitespace-tag.
	 */
	public static final char[] WHITESPACE_TAG_V2 = { (char)0x20, (char)0x20,(char)0x09,(char)0x09,(char)0x20,(char)0x20,(char)0x09,(char)0x20 };

	/**
	 * Indicator for no otr protocol support.
	 */
	public static final int PROTOCOL_NO_SUPPORT = 1024;
	/**
	 * Indicator for otr protocol version 1 support.
	 */
	public static final int PROTOCOL_VERSION_1 = 1;
	/**
	 * Indicator for otr protocol version 2 support.
	 */
	public static final int PROTOCOL_VERSION_2 = 2;

	/**
	 * The jOTR library status code for message ignore.
	 * 
	 * @see de.karnik.libjotr.Jotr#processIncomingMessage(JotrContext, StringBuffer)
	 * @see de.karnik.libjotr.Jotr#processOutgoingMessage(JotrContext, StringBuffer)
	 */
	public static final int MESSAGE_IGNORE = 1;
	/**
	 * The jOTR library status code for message encrypted.
	 * 
	 * @see de.karnik.libjotr.Jotr#processIncomingMessage(JotrContext, StringBuffer)
	 * @see de.karnik.libjotr.Jotr#processOutgoingMessage(JotrContext, StringBuffer)
	 */
	public static final int MESSAGE_ENCRYPTED = 2;
	/**
	 * The jOTR library status code for message plain.
	 * 
	 * @see de.karnik.libjotr.Jotr#processIncomingMessage(JotrContext, StringBuffer)
	 * @see de.karnik.libjotr.Jotr#processOutgoingMessage(JotrContext, StringBuffer)
	 */
	public static final int MESSAGE_PLAIN = 4;
	/**
	 * The jOTR library status code for message error.
	 * 
	 * @see de.karnik.libjotr.Jotr#processIncomingMessage(JotrContext, StringBuffer)
	 * @see de.karnik.libjotr.Jotr#processOutgoingMessage(JotrContext, StringBuffer)
	 */
	public static final int MESSAGE_ERROR = 8;
	
	/**
	 * The standard otr header as string.
	 */
	public static final String OTR_HEADER = "?OTR";
	/**
	 * The standard otr message header as string.
	 */
	public static final String OTR_MSG_HEADER = OTR_HEADER + ":";
	/**
	 * The standard otr error header as string.
	 */
	public static final String OTR_ERROR_HEADER = OTR_HEADER + " Error:";
	/**
	 * The standard otr query header for version 1 as string.
	 */
	public static final String OTR_QUERY_HEADER1 = OTR_HEADER + "?";
	/**
	 * The standard otr query header for version 2 as string.
	 */
	public static final String OTR_QUERY_HEADER2 = OTR_HEADER + "v";
	
	/**
	 * The otr request message of the jOTR library as string..
	 */
	public static final String OTR_REQUEST_MESSAGE = 	" has requested an "
	    												+ "<a href=\"http://otr.cypherpunks.ca/\">Off-the-Record "
	    												+ "private conversation</a>.  However, you do not have a plugin "
	    												+ "to support that.\nSee <a href=\"http://otr.cypherpunks.ca/\">"
	    												+ "http://otr.cypherpunks.ca/</a> or <a href=\"http://jotr.karnik.de/\">"
	    												+ "http://jotr.karnik.de</a> for more information.";
	
	/**
	 * Message was received unencrypted error message as string.
	 */
	public static final String OTR_MESSAGE_UNECRYPTED = 	"This message was received unencrypted: ";
	
	/**
	 * Initial aes ctr value. (0)
	 */
	public static byte[] CTR_ZERO_VAL = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

	/**
	 * The length of the integer datatype.
	 */
	public static final int INT_BYTE_LENGTH = 4;
	/**
	 * The length of the short datatype.
	 */
	public static final int SHORT_BYTE_LENGTH = 2;
	/**
	 * The length of the byte datatype.
	 */
	public static final int BYTE_BYTE_LENGTH = 1;
	/**
	 * The length of the ctr datatype.
	 */
	public static final int CTR_BYTE_LENGTH = 8;
	/**
	 * The length of the mac datatype.
	 */
	public static final int MAC_BYTE_LENGTH = 20;
	
	
	/**
	 * Hashing byte and id for the session id.
	 */
	public static final int SSID = 0;
	/**
	 * Unique id for the aes key c.
	 */
	public static final int KEY_C = 1;
	/**
	 * Unique id for the key ci.
	 */
	public static final int KEY_C_I = 2;
	/**
	 * Unique id for the aes key m1.
	 */
	public static final int KEY_M1 = 4;
	/**
	 * Unique id for the mac key m2.
	 */
	public static final int KEY_M2 = 8;
	/**
	 * Unique id for the mac key m1i.
	 */
	public static final int KEY_M1_I = 16;
	/**
	 * Unique id for the mac key m2i.
	 */
	public static final int KEY_M2_I = 32;
	
	/**
	 * Hashing byte for the ake aes key c.
	 */
	public static final byte BYTE_C = 0x01;
	/**
	 * Hashing byte for the ake mac key m1.
	 */
	public static final byte BYTE_M1 = 0x02;
	/**
	 * Hashing byte for the ake mac key m2.
	 */
	public static final byte BYTE_M2 = 0x03;
	/**
	 * Hashing byte for the ake mac key m1-I.
	 */
	public static final byte BYTE_M1_I = 0x04;
	/**
	 * Hashing byte for the ake mac key m2-I.
	 */
	public static final byte BYTE_M2_I = 0x05;
	
	/**
	 * Initial old key id.
	 */
	public static final int KEYID_OLD = 1;
	/**
	 * Initial new key id.
	 */
	public static final int KEYID_NEW = 2;
}